package com.yj.web.dao.mapper;

import com.yj.web.dao.po.admin.ViewRole;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface ViewRoleMapper {
    @Insert("insert into view_role (role_number, view) values (#{viewRole.roleNumber}, #{viewRole.view})")
    @Options(useGeneratedKeys = true, keyProperty = "employee.id")
    public long insert(@Param("viewRole") ViewRole viewRole);

    @Select("select id, role_number as roleNumber, view from view_role where deleted = 0 order by id desc")
    public List<ViewRole> listViewRole();

    @Delete("update view_role set deleted = 1 where id = #{id}")
    public int deleteById(@Param("id") long id);
}
